<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>集装箱信息</title>
	<script type="text/javascript">
		var menu_flag = 'container';
	</script>
</head>
<body>
	
	<div class="sitemap" id="sitemap">
		当前位置: <a href="list">集装箱</a> -&gt; 修改集装箱
	</div>
	
	<div class="mainoutside mt18">
		<div id="secmainoutside">
			<div class="title">修改集装箱</div>
			
			<form id="editForm" action="" method="post">
				<table class="mainadd">
					<tbody>
						<input type="hidden" name="id" value="${obj.id}"/>
						<tr>
							<td class="size">尺寸</td>
							<td class="content">
								<input type="text" class="text" id="size" name="size"  value="${obj.size}" maxlength='32'/>
								<span class="red">*</span>
							</td>
							<td class="content_info">
								<span id="span_size"></span><span></span>
							</td>
						</tr>
						
						<tr>
							<td class="size">最大重量</td>
							<td class="content">
								<input type="text" class="text" id="maxWeigth" name="maxWeigth" value="${obj.maxWeigth}" maxlength='32'/>
								<span class="red"></span>
							</td>
							<td class="content_info">
								<span id="span_maxWeigth"></span><span></span>
							</td>
						</tr>
						
						<tr>
							<td class="size">最大容量</td>
							<td class="content">
								<input type="text" class="text" id="maxVolume" name="maxVolume" value="${obj.maxVolume}" maxlength='32'/>
								<span class="red"></span>
							</td>
							<td class="content_info">
								<span id="span_maxVolume"></span><span></span>
							</td>
						</tr>
					</tbody>
					<tfoot>
						<tr>
							<td class="name"></td>
							<td class="btn">
								<input type="submit" class="bigbutsubmit" value="提交"  id="butsubmit_id"/>
								<input type="button" class="bigbutsubmit" onclick="javascript:window.location.href='list';" value="返回"/>
							</td>
						</tr>
					</tfoot>
				</table>
			</form>
		</div>
	</div>
	<script type="text/javascript">
			$(document).ready(function(){
				$("#editForm").validate({
					rules: {
						"size": {
			                                required: true,
			                                maxlength: 100
			                            },
			           "maxWeigth": {
			                                digits: true
			                            },
			           "maxVolume": {
			                                digits: true
			                            }                 
					},
					messages: {
						"size": {
							required: "请输入集装箱尺寸",
			                maxlength: "名称最长不得超过50个字符"
						},
						"maxWeigth": {
							digits: "必需是数字"
						},
						"maxVolume": {
							digits: "必需是数字"
						}
					},
					errorPlacement: function(error, element){
						$("#span_" + element.attr("id")).html(error).attr("class", "error").addClass('red').next().hide();
					},
					submitHandler: function(form) {
						$("#butsubmit_id").attr("disabled","true");
						setDisabled('input[type="submit"]', window.document)
						$(form).ajaxSubmit({
							 success: function(response){
				        		var data = eval("("+response+")");
				        		if(data.flag==0){
			            			$.alert('修改集装箱成功', function(){window.location.href = "list";});
			            		}else{
			            			$.alert('此箱型已存在,请重新输入');
			                		$("#butsubmit_id").attr("disabled","false");
			            		}
				        		setabled('input[type="submit"]', window.document);
				            }
			            });
					},
					success: function(label){
						var labelparent = label.parent();
						label.parent().html(labelparent.next().html()).attr("class", "valid");
					},
					onkeyup:false
				});
					
			});
	</script>
</body>
</html>